//
//  AddViewController.m
//  UI_Contact
//
//  Created by dllo on 15/9/17.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "AddViewController.h"

@interface AddViewController ()

@end

@implementation AddViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self createTextField];
    
    [self createButton];
    // Do any additional setup after loading the view.
}

- (void)createTextField
{
    self.name = [[UITextField alloc]initWithFrame:CGRectMake(50, 80, self.view.frame.size.width - 100, 40)];
    self.name.borderStyle = 3;
    [self.view addSubview:self.name];
    self.name.placeholder = @"请输入姓名";
    
    self.phone = [[UITextField alloc]initWithFrame:CGRectMake(50, 150, self.view.frame.size.width - 100, 40)];
    self.phone.borderStyle = 3;
    [self.view addSubview:self.phone];
    self.phone.placeholder = @"请输入电话号码";
}

- (void)createButton
{
    UIButton *submit = [UIButton buttonWithType:UIButtonTypeSystem];
    submit.frame = CGRectMake(100, 200, 100, 50);
    [submit setTitle:@"submit" forState:UIControlStateNormal];
    [submit addTarget:self action:@selector(sub:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:submit];
    
    
}

- (void)sub:(UIButton *)button
{
    
    [self.delegate sendValues:self.name.text phone:self.phone.text];
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
